The proper functioning of a power grid requires continuous matching of supply and demand in the grid, in spite of the randomness of electric loads and the uncertainty of generation. A direct consequence of a supply-demand mismatch is a deviation in the system frequency. Since large frequency deviations can compromise the stability of the power grid, various “ancillary services” are used to compensate for the supply-demand imbalance. For example, ancillary services such as regulation and load following may be used to manage the supply-demand balance.